<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
         

        class Phone {
            a=1 // 这里定义a=1实际上是给实例对象添加一个属性a,值为1,等价于在constructor里面定义了
            constructor (brand, price) {
                this.brand = brand
                this.price = price
            }
            // 父类的成员属性
            call() {
                console.log('call')
            }
        }
        console.log(Phone.prototype)
        class SmartPhone extends Phone {
            constructor(brand,price,color,size) {
                // super就是父类的constructor方法
                // 子类调用父类构造方法来做初始化
                super(brand,price)
                this.color = color
                this.size = size
            }
            photo () {
                console.log('photo') 
            }
            play () {
                console.log('play') 
            }
        }

        let s = new SmartPhone('1+',1888,'红色', 18)
        s.call()
        console.log(s)



















    </script>
</body>
</html>